package lion.dev.thread;

public class ThreadRunner extends Thread {

	private boolean shutdown = false;
	private Runnable runnable;

	public ThreadRunner(Runnable runnable) {

		this.runnable = runnable;
	}

	@Override
	public void run() {

		while (!shutdown && !this.isInterrupted()) {
			runnable.run();
		}
	}

	public void shutdown() {

		shutdown = true;
		interrupt();
	}
}
